<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use kartik\file\FileInput;
use kartik\select2\Select2;
use yii\web\JsExpression;
use app\common\Functions;
use kartik\date\DatePicker;

/* @var $this yii\web\View */
/* @var $model \yii2mod\rbac\models\BizRuleModel */
/* @var $form ActiveForm */
?>

<?php

$fieldOptions  = [];
$labelOptions  = [];
$fieldOptions['class']  = 'col-md-6';
$options['options']=$fieldOptions;
$selectOptions = [];
$selectOptions['style'] = 'width:100%';
$selectOptions['class'] = ' select2 select2-hidden-accessible';

//默认的字段类型
$defineFieldStyle = [
    'template'      => "{label}\n<div class=\"col-sm-8\">{input}</div>\n{error}",
    'labelOptions' => ['class' => 'col-sm-3 control-label']];

?>



<?php $form = ActiveForm::begin([
    'options'=>['class' => 'form-horizontal']
]); ?>
<div class="box-body">


     <?php  echo  $form->field($model, 'id',['labelOptions'=>['style'=>'display:none']])->hiddenInput(['value' => $model->id]); ?>

    <?php if($wx==null): ?>

        <?php  echo  $form->field($model, 'yq_day_amount',$defineFieldStyle)->label( '1735访客数')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'yq_day_fee',$defineFieldStyle)->label( '1735成本')->textInput(['maxlength' => 64]); ?>

        <?php  echo  $form->field($model, 'sq_day_amount',$defineFieldStyle)->label( '1735咨询量')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'sq_day_fee',$defineFieldStyle)->label( '1735咨询成本')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'yx_day_amount',$defineFieldStyle)->label( '1735有效咨询量')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'yx_day_fee',$defineFieldStyle)->label( '1735有效咨询成本')->textInput(['maxlength' => 64]); ?>

        <?php  echo  $form->field($model, 'tb_day_amount',$defineFieldStyle)->label( '淘办访客数')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'tb_day_fee',$defineFieldStyle)->label( '淘办成本')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'tbsq_day_amount',$defineFieldStyle)->label( '淘办咨询量')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'tbsq_day_fee',$defineFieldStyle)->label( '淘办咨询成本')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'tbyx_day_amount',$defineFieldStyle)->label( '淘办有效咨询总量')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'tbyx_day_fee',$defineFieldStyle)->label( '淘办有效咨询成本')->textInput(['maxlength' => 64]); ?>


        <?php  echo  $form->field($model, 'wt_day_amount',$defineFieldStyle)->label( '日外推数量')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'qd_day_amount',$defineFieldStyle)->label( '日增渠道数')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'day_income',$defineFieldStyle)->label( '日收入佣金')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'day_area',$defineFieldStyle)->label( '日签约面积')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'url',$defineFieldStyle)->label( 'url')->textArea(['maxlength' => 500,'style'=>'height:100px;','placeholder'=>'输入网址后请回车']); ?>

    <?php else: ?>

        <?php  echo  $form->field($model, 'fans_amount',$defineFieldStyle)->label( '维护粉丝数')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'article_amount',$defineFieldStyle)->label( '日文章数')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'publish_amount',$defineFieldStyle)->label( '日发布数')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'readed_fee',$defineFieldStyle)->label( '日阅读量')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'repeat_amount',$defineFieldStyle)->label( '日转发数')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'channel_amount',$defineFieldStyle)->label( '日增渠道数')->textInput(['maxlength' => 64]); ?>
        <?php  echo  $form->field($model, 'advice_amount',$defineFieldStyle)->label( '日咨询总量')->textInput(['maxlength' => 64]); ?>
    <?php endif; ?>
    <!--    --><?php // echo  $form->field($model, 'data_date',$defineFieldStyle)->label( '数据日期')->textInput(['maxlength' => 64]); ?>

    <?php if($update): ?>

       <div style="display: none">
    <?php endif; ?>


    <?= $form->field($model, 'data_date',$defineFieldStyle)->label( '数据日期')->widget(DatePicker::classname(), [
        'options' => ['placeholder' => ''],
        'pluginOptions' => [
            'autoclose' => true,
            'todayHighlight' => true,
            'format' => 'yyyy-mm-dd',
        ]
    ]); ?>

    <?php if($update): ?>
        </div>
    <?php endif; ?>




    <div class="box-footer">
        <?php echo Html::submitButton($model->getIsNewRecord() ? Yii::t('region', 'Create') : Yii::t('region', 'Update'), [
            'class' => $model->getIsNewRecord() ? 'btn btn-success' : 'btn btn-primary', ]); ?>
        <?php echo Html::a(Yii::t('region', 'Cancel'), Yii::$app->request->getReferrer(), ['class' => 'btn btn-default']); ?>
    </div>

</div>
<?php ActiveForm::end(); ?>

<?php

$js = <<<JS
jQuery('#customtableview-attr_spec_id').on('change',function() {
    
    $.post('/config/custom/autoattr?attr_spec_id='+$(this).val(),          
      
    function(data){
    $("#customtableview-attr_spec_width").val(data.results.attr_spec_width);
    $("#customtableview-show_name").val(data.results.attr_spec_name);
 
                      
     });
});
JS;
$this->registerJs($js);

?>

